<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item label="用户账号">
        <el-input v-model="queryParams.mobile" placeholder="请输入用户账号" clearable style="width: 240px" @keyup.enter.native="getList" />
      </el-form-item>
      <el-form-item label="订单id">
        <el-input v-model="queryParams.orderId" placeholder="请输入订单id" clearable style="width: 240px" @keyup.enter.native="getList" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="getList" >搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="dataList">
      <el-table-column label="序号" align="center" type="index" />
      <el-table-column label="用户昵称" align="center" prop="nickName" min-width="140" />
      <el-table-column label="用户账号" align="center" prop="mobile" min-width="140" />
      <el-table-column label="主id" align="center" prop="logId" min-width="140" />
      <el-table-column label="订单id" align="center" prop="orderId" min-width="180" />
      <el-table-column label="发放金额" align="center" prop="awardAmount" min-width="140" />
      <el-table-column label="奖励名称" align="center" prop="awardName" min-width="140" />
      <el-table-column label="奖励时间" align="center" prop="awardTime" min-width="100" />
      <el-table-column label="发放钱包" align="center" prop="walletName" min-width="140" />
      <el-table-column label="失败原因" align="center" prop="errorMessage" min-width="140" />
      <el-table-column label="发放时间" align="center" prop="sendTime" min-width="100" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="140" show-overflow-tooltip>
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-check" @click="appropriation(scope.row)">补发</el-button> <br />
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList" />

  </div>
</template>

<script>
import { reissueData,getDataList} from "@/api/weeklyWage/weeklyWage.js";
export default {
  name: "weeklyWage",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 订单表格数据
      dataList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        mobile: null,
        orderId: null,
      },
      // 表单参数
      form: {},
      // 表单校验
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        pageNo: 1,
        pageSize: 10,
        mobile: null,
        orderId: null,
      };
      this.getList();
    },
    // 补发
    appropriation(data){
      let that = this
      that.$modal.confirm('是否确认补发？').then(function() {
        reissueData(data.logId).then(res => {
          if(res.code === 200){
            that.$modal.msgSuccess("操作成功");
            that.getList();
          }
        })
      })
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      getDataList(this.queryParams).then((response) => {
        if(response.code == 200){
          this.dataList = response.data.records;
          this.total = response.data.total;
          this.loading = false;
        }
      });
    },
  },
};
</script>
<style>
.m-t-5{
  margin-top: 5px;
}
.closeBtn{
  font-size: 24px;
  position: absolute;
  right: -2px;
  top: -2px;
}
.flex{
  display: flex;
}
.m-l-20{
  margin-left: 20px;
}
.blue{
  color: #409eff;
}
.imgBox{
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}
.el-input.is-disabled .el-input__inner{
  color: #606266;
}
.minH{
  min-height: 400px;
}
</style>
